package cn.fighter3.controller;

import cn.fighter3.entity.node.Book;
import cn.fighter3.entity.node.CustomNode;
import cn.fighter3.entity.node.Fgbook;
import cn.fighter3.result.Result;
import cn.fighter3.service.impl.FgbookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/api/fgbook")
public class FgbookController {

    @Autowired
    FgbookService fgbookService;

    @GetMapping("/all")
    public Result findAll(){
        List<Fgbook> fgbookList = fgbookService.findAll();
        List<CustomNode> customNodes = new ArrayList<>();
//        for (Book fgb : fgbookList){
//            customNodes.add(new CustomNode(fgb.getTitle(),  3,fgb));
//
//        }
//        //return customNodes;
        return (new Result(200,"hello",customNodes));
    }

}
